#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <arpa/inet.h>
#include <netinet/in.h>
#include <sys/socket.h>
#include <fcntl.h>

int main(int argc, char *argv[])
{
	int ret = 0;
	int sockfd;
	struct sockaddr_in cli_addr;
	socklen_t socklen = sizeof(cli_addr);

	sockfd = socket(AF_INET,SOCK_STREAM,0);
	if(sockfd < 0)
	{
		perror("socket error:");
		exit(EXIT_FAILURE);
	}
	memset(&cli_addr,0,socklen);
	cli_addr.sin_family = AF_INET;
	cli_addr.sin_addr.s_addr = inet_addr("202.105.132.136");
	cli_addr.sin_port = htons(4900);

	if(connect(sockfd,(struct sockaddr*)&cli_addr,socklen)<0)
	{
		perror("connect error:");
		exit(EXIT_FAILURE);
	}

	char sendbuff[1024]={0};
	memset(sendbuff,1,sizeof(1024));
	while(1)
	{
		ret = send(sockfd,sendbuff,sizeof(sendbuff),0);
		if(ret > 0)
			printf("send ret = %d\n",ret);
		else if(ret < 0)
			perror("send error:");

		usleep(30000);
	}

	return 0;
}


